package com.pdwl.cashoutpay.controller;

import com.pdwl.cashoutpay.util.JsonUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("test")
public class TestDemo {
//
//    public static void main(String[] args) {
//
//        String res= "{\"data\":{\"cardNo\":\"6225768648119483\",\"channelOrderNo\":\"400024772\",\"orderNo\":\"12320180317102024\",\"realName\":\"占奎\",\"subMerchantCode\":\"1803161419370442038\",\"tradeTotal\":\"500\"},\"errorCode\":\"000000\",\"errorMessage\":\"成功\",\"flag\":true}";
//        JSONObject json=JSONObject.fromObject(res);
//        String data=json.getString("data");
//        JSONObject message=JSONObject.fromObject(data);
//        String channelOrderNo=message.getString("channelOrderNo");
//        System.out.println("收到数据"+res);
//    }

    @RequestMapping("lifeMerchant")
    public  void responseRegister(HttpServletRequest request, HttpServletResponse response) throws  Exception{
        System.out.println("进入二级商户create回调方法！");
        JSONObject json = JsonUtil.getJson(request);
//        String outMerchantCode=""+json.get("outMerchantCode");//我们分配给他们的商户号
        System.out.println(json.toString());

    }

    @RequestMapping("costMail")
    public  void costMail(HttpServletRequest request, HttpServletResponse response) throws  Exception{
        System.out.println("进入二级商户cost回调方法！");
        JSONObject json = JsonUtil.getJson(request);
//        String outMerchantCode=""+json.get("outMerchantCode");//我们分配给他们的商户号
        System.out.println(json.toString());

    }

    @RequestMapping("mailCheck")
    public  void mailCheck(HttpServletRequest request, HttpServletResponse response) throws  Exception{
        System.out.println("进入二级商户mailCkeck回调方法！");
        JSONObject json = JsonUtil.getJson(request);
//        String outMerchantCode=""+json.get("outMerchantCode");//我们分配给他们的商户号
        System.out.println(json.toString());

    }
}
